The present invention relates to a coding apparatus for converting a video signal into a coded bit stream by performing variable-bit-rate control in real time.
MPEG-2 is an international standard defining an exemplary method of compression-coding a video signal. According to the MPEG-2 standard, a highly compressed video of excellent quality is obtained by the following techniques. Specifically, an image on the screen is divided into a plurality of blocks. Each block consists of a plurality of pixels, and is subjected to discrete cosine transform (DCT). The resultant transform coefficients are subjected to quantization and then variable-length coded, thereby removing spatial redundancy. In addition, temporal redundancy can also be removed by performing intra-frame coding, inter-frame forward predictive coding with motion compensation and inter-frame bidirectional predictive coding in combination.
Generally speaking, any video is a mixture of scenes with relatively high coding complexities, e.g., a scene with a lot of motion or complex patterns, and scenes with relatively low coding complexities, e.g., a monotonous scene with little motion. If a sufficiently large number of bits are not allocated to a scene with a high coding complexity, then various types of noise unique to the DCT coding, e.g. , block noise and mosquito noise, are generated, thus considerably deteriorating the resultant image quality.
Accordingly , to ensure high image quality by fixed-bit-rate control, coding needs to be performed at a high bit rate adapted to a scene with a high coding complexity. As a result, an excessively large number of bits are allocated to a scene with a low coding complexity. Thus in recording a coded bit stream obtained in this manner on a storage medium, an unnecessarily large storage capacity is required compared to that resulting from variable-bit-rate control.
In view of these, the MPEG-2 compression coding technique utilizing the variable-bit-rate control is applied to a digital video disk (DVD) player using an optical disk as a storage medium. According to the conventional techniques, however, a video should be processed through at least two paths, namely, according complexity estimation and coding. That is to say, the conventional variable-bit-rate control cannot be performed in real time, because the complexity of a scene to be recorded should be estimated in advance, and then coding should be performed with an appropriate number of bits allocated depending on the complexity estimated.
An object of the present invention is providing a variable-bit-rate coding apparatus adapted to convert a video signal into a coded bit stream in real time.
To achieve this object, a coding apparatus according to the present invention includes a compression coder for compression-coding a video signal to output a coded bit stream with a variable bit rate corresponding to a variable number of bits allocated. The apparatus also includes means for calculating a cumulative error by sequentially adding up errors, each representing a difference between a given average target number and a number of bits generated during every predetermined period of the coded bit stream. The apparatus further includes: a coding complexity detector for detecting a coding complexity indicating how difficult to code a scene represented by the video signal is; a change detector for detecting a change of scenes; and a bit allocator. As for a frame just after the change of scenes, the bit allocator determines the allocated bit number by presetting a provisionally allocated bit number based on the coding complexity detected such that a number of bits allocated to a scene with a high coding complexity exceeds the average target number. And if the cumulative error exceeds a predetermined value, the bit allocator corrects the provisionally allocated bit number in accordance with the magnitude of the cumulative error such that the provisionally allocated bit number is reducible to, but not less than, the average target number. As for frames within the same scene on the other hand, the bit allocator sequentially updates a previous value of the allocated bit number such that the cumulative error does not exceed a predetermined maximum value thereof.
The present invention provides a variable-bit-rate coding apparatus for converting a video signal into a coded bit stream in real time. In addition, even if a series of scenes with high coding complexities appear consecutively, a number of bits allocated to each of these scenes can always be at least equal to the average target number, while at the same time the total number of bits generated can be regulated. As a result, high image quality is ensured. Thus, a video signal for a prescribed period of time can be recorded in real time on some storage medium on which a variable rate bit stream is recordable, such as a recordable optical disk like a DVD or a hard disk, with an optimum number of bits allocated based on the residual capacity of the storage medium and the coding complexity of the video signal.